package com.tech.params;

import java.io.Serializable;
import java.util.Date;
import com.tech.pojo.ItemDesc;
import com.tech.util.IDUtil;

/**
* @Title ItemParams.java
* @Description 商品属性
* @author willard
* @date 2018年12月19日 下午2:00:49
* @version V1.0
*/
public class ItemParams implements Serializable{

    /** 
     * 
     */ 
     private static final long serialVersionUID = 1L;

     /**
      * 商品id，同时也是商品编号
      */
     private Long id;

     /**
      * 商品标题
      */
     private String title;

     /**
      * 商品卖点
      */
     private String sellPoint;

     /**
      * 商品价格，单位为：分
      */
     private Long price;

     /**
      * 库存数量
      */
     private Integer num;

     /**
      * 商品条形码
      */
     private String barcode;

     /**
      * 商品图片
      */
     private String image;

     /**
      * 所属类目，叶子类目
      */
     private Long cid;

     /**
      * 商品状态，1-正常，2-下架，3-删除
      */
     private Byte status;

     /**
      * 创建时间
      */
     private Date created;

     /**
      * 更新时间
      */
     private Date updated;
     
     
    /** 
    * 商品描述
    */ 
    private String itemDesc;


    public Long getId() {
        return id;
    }


    public String getTitle() {
        return title;
    }


    public String getSellPoint() {
        return sellPoint;
    }


    public Long getPrice() {
        return price;
    }


    public Integer getNum() {
        return num;
    }


    public String getBarcode() {
        return barcode;
    }


    public String getImage() {
        return image;
    }


    public Long getCid() {
        return cid;
    }


    public Byte getStatus() {
        return status;
    }


    public Date getCreated() {
        return created;
    }


    public Date getUpdated() {
        return updated;
    }


    public String getItemDesc() {
        return itemDesc;
    }


    public void setId(Long id) {
        this.id = id;
    }


    public void setTitle(String title) {
        this.title = title;
    }


    public void setSellPoint(String sellPoint) {
        this.sellPoint = sellPoint;
    }


    public void setPrice(Long price) {
        this.price = price;
    }


    public void setNum(Integer num) {
        this.num = num;
    }


    public void setBarcode(String barcode) {
        this.barcode = barcode;
    }


    public void setImage(String image) {
        this.image = image;
    }


    public void setCid(Long cid) {
        this.cid = cid;
    }


    public void setStatus(Byte status) {
        this.status = status;
    }


    public void setCreated(Date created) {
        this.created = created;
    }


    public void setUpdated(Date updated) {
        this.updated = updated;
    }


    public void setItemDesc(String itemDesc) {
        this.itemDesc = itemDesc;
    }

    @Override
    public String toString() {
        return "ItemParams [id=" + id + ", title=" + title + ", sellPoint=" + sellPoint + ", price=" + price + ", num="
                + num + ", barcode=" + barcode + ", image=" + image + ", cid=" + cid + ", status=" + status
                + ", created=" + created + ", updated=" + updated + ", itemDesc=" + itemDesc + "]";
    }
    
    /**
    * @Title initItem
    * @Description 订单详情
    * {@link }
    * @since 2018年12月19日 下午3:27:17
    */
    public void initItem() {
        long itemId = IDUtil.genItemId();
        this.setId(itemId);
        this.setStatus((byte)1);
        this.setCreated(new Date());
    }
    
    /**
    * @Title getItemDesc
    * @Description 订单描述
    * {@link }
    * @since 2018年12月19日 下午7:05:14
    */
    public ItemDesc initItemDesc(ItemParams params){
      ItemDesc itemDesc = new ItemDesc();
      // 补全pojo的属性
      itemDesc.setItemId(params.getId());
      itemDesc.setItemDesc(params.getItemDesc());
      itemDesc.setCreated(new Date());
      return itemDesc;
    }
}
